import {getStorageSync,setStorageSync,removeStorageSync,clearStorageSync} from '@tarojs/taro'


export function getItem(key, defaultVal = null) {
  return getStorageSync(key) ? getStorageSync(key) : defaultVal
}

export function setItem(key, value = null) {
  
  setStorageSync(key, value)
}

export function removeItem(key) {
  removeStorageSync(key)
}

export function clearStorage(key) {
  clearStorageSync()
}

export function copyObj(val){
  return JSON.parse(JSON.stringify(val))
}
